-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add new wot-models definition update endpoint #1843 #2103
Open
hu-ahmed
wants to merge
8
commits into
eclipse-ditto:master
Choose a base branch
from
beyonnex-io:support-updating-referenced-WoT-ThingModel
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
add new wot-models definition update endpoint #1843 #2103
hu-ahmed
wants to merge
8
commits into
eclipse-ditto:master
from
beyonnex-io:support-updating-referenced-WoT-ThingModel
+3,181
−9
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aed41df
to
5d5b2f8
Compare
thjaeckle
requested changes
Jan 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @hu-ahmed and thanks a lot for providing this PR.
Looks already really promising .. I did a quick check and left a few comments before going deeper :)
documentation/src/main/resources/openapi/sources/api-2-index.yml
Outdated
Show resolved
Hide resolved
documentation/src/main/resources/openapi/sources/api-2-index.yml
Outdated
Show resolved
Hide resolved
documentation/src/main/resources/openapi/sources/paths/things/thing.yml
Outdated
Show resolved
Hide resolved
...entation/src/main/resources/openapi/sources/schemas/things/migrateThingDefinitionRequest.yml
Show resolved
Hide resolved
documentation/src/main/resources/pages/ditto/httpapi-concepts.md
Outdated
Show resolved
Hide resolved
...main/java/org/eclipse/ditto/things/model/signals/commands/modify/MigrateThingDefinition.java
Outdated
Show resolved
Hide resolved
...main/java/org/eclipse/ditto/things/model/signals/commands/modify/MigrateThingDefinition.java
Outdated
Show resolved
Hide resolved
...main/java/org/eclipse/ditto/things/model/signals/commands/modify/MigrateThingDefinition.java
Outdated
Show resolved
Hide resolved
...main/java/org/eclipse/ditto/things/model/signals/commands/modify/MigrateThingDefinition.java
Outdated
Show resolved
Hide resolved
...to/things/service/persistence/actors/strategies/commands/MigrateThingDefinitionStrategy.java
Outdated
Show resolved
Hide resolved
thjaeckle
reviewed
Jan 29, 2025
...to/things/service/persistence/actors/strategies/commands/MigrateThingDefinitionStrategy.java
Outdated
Show resolved
Hide resolved
thjaeckle
reviewed
Jan 29, 2025
...to/things/service/persistence/actors/strategies/commands/MigrateThingDefinitionStrategy.java
Outdated
Show resolved
Hide resolved
thjaeckle
reviewed
Jan 29, 2025
...to/things/service/persistence/actors/strategies/commands/MigrateThingDefinitionStrategy.java
Outdated
Show resolved
Hide resolved
thjaeckle
reviewed
Jan 29, 2025
...to/things/service/persistence/actors/strategies/commands/MigrateThingDefinitionStrategy.java
Outdated
Show resolved
Hide resolved
thjaeckle
reviewed
Jan 29, 2025
...to/things/service/persistence/actors/strategies/commands/MigrateThingDefinitionStrategy.java
Outdated
Show resolved
Hide resolved
thjaeckle
reviewed
Jan 29, 2025
...to/things/service/persistence/actors/strategies/commands/MigrateThingDefinitionStrategy.java
Outdated
Show resolved
Hide resolved
thjaeckle
reviewed
Jan 29, 2025
...to/things/service/persistence/actors/strategies/commands/MigrateThingDefinitionStrategy.java
Outdated
Show resolved
Hide resolved
thjaeckle
reviewed
Jan 29, 2025
...to/things/service/persistence/actors/strategies/commands/MigrateThingDefinitionStrategy.java
Outdated
Show resolved
Hide resolved
thjaeckle
reviewed
Jan 29, 2025
...to/things/service/persistence/actors/strategies/commands/MigrateThingDefinitionStrategy.java
Outdated
Show resolved
Hide resolved
thjaeckle
reviewed
Jan 29, 2025
...to/things/service/persistence/actors/strategies/commands/MigrateThingDefinitionStrategy.java
Outdated
Show resolved
Hide resolved
thjaeckle
reviewed
Jan 29, 2025
...to/things/service/persistence/actors/strategies/commands/MigrateThingDefinitionStrategy.java
Show resolved
Hide resolved
thjaeckle
reviewed
Jan 29, 2025
...to/things/service/persistence/actors/strategies/commands/MigrateThingDefinitionStrategy.java
Outdated
Show resolved
Hide resolved
thjaeckle
reviewed
Jan 30, 2025
...main/java/org/eclipse/ditto/things/model/signals/commands/modify/MigrateThingDefinition.java
Show resolved
Hide resolved
thjaeckle
reviewed
Jan 30, 2025
...to/things/service/persistence/actors/strategies/commands/MigrateThingDefinitionStrategy.java
Outdated
Show resolved
Hide resolved
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#1843
The migrateThingDefinition endpoint introduces a comprehensive mechanism for migrating a Thing's definition while ensuring data consistency and applying necessary migrations. This endpoint is designed to facilitate seamless updates by incorporating a structured approach to definition changes and migration payloads.
Key Features:
Definition Update with Skeleton Generation:
The provided Thing definition URL is used to generate a new skeleton Thing, which serves as the baseline for the update.
The skeleton includes a hierarchical representation of the Thing, ensuring consistency with the WoT model.
Patch Condition Evaluation:
The migration payload can include multiple patch conditions, evaluated using RQL-based expressions to determine whether specific updates should be applied.
This allows for conditional updates based on existing Thing attributes or feature values.
Merging Strategy:
The update process merges the newly generated skeleton with the existing Thing while preserving essential attributes and properties.
An optional initialization step applies default values from the skeleton to fill in missing or incomplete properties.
Migration Payload Application:
The provided migration payload is selectively merged into the updated Thing, allowing for targeted modifications without overriding all properties.
Ensures data integrity by applying only necessary changes based on predefined rules.
Dry-Run Mode:
The API supports a dry-run option (dryRun: true), allowing users to simulate the migration without persisting changes.
Validation and Persistence:
Before finalizing the update, the modified Thing undergoes WoT model validation based on the current configuration, so either it will be rejected or logged as warning in case of inconsistency.
Ditto Protocols supported:
this command is also available for other ditto protocols
API Usage:
Endpoint:
POST /api/2/things/{thingId}/migrateDefinition
Request Body: